<html>
    <head>
        <meta charset="UTF-8">
        <title>js获取浏览器版本</title>
        <body>
            <input type="button" value="get browse" name="get browse" onclick="Browse ()";/>
        </body>
    </head>
</html>
<script>
function ScreenWidth () {
    return window.screen.width;
};
/***获得屏幕高度**/
function ScreenHeight () {
    return window.screen.height;
};
/**获得浏览器***/
function Browse () {
    var browser = {};
    var userAgent = navigator.userAgent.toLowerCase();
    var s;
    (s = userAgent.match(/mise([\d.]+)/)) ? browser.ie = s[1] : (s = userAgent.match(/firefox\/([\d.]+)/)) ? browser.firefox = s[1] : (s = userAgent.match(/chrome\/([\d.]+)/)) ? browser.chrome = s[1] : (s = userAgent.match(/opera.([\d.]+)/)) ? browser.opera = s[1] : (s = userAgent.match(/version\/([\d.]+).*safari/)) ? browser.safari = s[1] : 0;
    var version = "";
    if (browser.ie) {
        version = 'IE ' + browser.ie;
    }
    else {
        if (browser.firefox) {
            version = 'firefox ' + browser.firefox;
        }
        else {
            if (browser.chrome) {
                version = 'chrome ' + browser.chrome;
            }
            else {
                if (browser.opera) {
                    version = 'opera ' + browser.opera;
                }
                else {
                    if (browser.safari) {
                        version = 'safari ' + browser.safari;
                    }
                    else {
                        version = '未知浏览器';
                    }
                }
            }
        }
    }
    return version;
}
alert("您的浏览器版本是："+Browse());

console.log("您的浏览器版本是："+Browse())
</script>